﻿using DependencyInjectionDemo.Services;
using Microsoft.Extensions.DependencyInjection;

var services = new ServiceCollection();
services.AddTransient<IOrderService, OrderService>();

using (var serviceProvider = services.BuildServiceProvider(true))
{
    var scope = serviceProvider.CreateScope();
    var orderService = scope.ServiceProvider.GetRequiredService<IOrderService>();
    orderService.AutoCancel();
}

Console.ReadLine();